package com.hue.springcloud.controller;

import com.hue.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PaymentController {
    @Autowired
    private PaymentService paymentService;

    @GetMapping("/payment/hystrix/ok")
    public String ok(){
        return paymentService.ok();
    }

    @GetMapping("/payment/hystrix/timeout")
    public String timeout() throws InterruptedException {
        return paymentService.timeout();
    }

    @GetMapping("/payment/hystrix/fusing/{id}")
    public String fusing(@PathVariable("id") int id){
        return paymentService.fusing(id);
    }
}
